package work.chenxr.aop.controller;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import work.chenxr.aop.annotations.OperateLog;
import work.chenxr.aop.enums.OperateTypeEnum;

/**
 * @Author Chenxr
 * @Date 2023/09/18
 * @Description 测试
 */
@RestController
@RequestMapping("/aop")
public class AopController {
    @OperateLog(module = "AOP测试", name = "查询", type = OperateTypeEnum.QUERY)
    @GetMapping(value = "/query", produces = MediaType.APPLICATION_JSON_VALUE)
    public Object query(Object object) {
        return object;
    }

    @OperateLog(module = "AOP测试", name = "新增", type = OperateTypeEnum.INSERT)
    @PostMapping(value = "/save", produces = MediaType.APPLICATION_JSON_VALUE)
    public Object save(@RequestBody Object object) {
        return object;
    }

    @OperateLog(module = "AOP测试", name = "修改", type = OperateTypeEnum.UPDATE)
    @PutMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
    public Object update(@RequestBody Object object) {
        return object;
    }

    @OperateLog(module = "AOP测试", name = "删除", type = OperateTypeEnum.DELETE)
    @DeleteMapping(value = "/delete", produces = MediaType.APPLICATION_JSON_VALUE)
    public Object delete(Object object) {
        return object;
    }

}
